<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--  react核心库  -->
    <script src="lib/react.development.js"></script>
    <!--  reactdom:操作DOM  -->
    <script src="lib/react-dom.development.js"></script>
    <script src="lib/babel.min.js"></script>
</head>
<body>
<!--指定挂载的位置-->
<div id="root"></div>
</body>
<script type="text/babel">
    const root = ReactDOM.createRoot(document.querySelector('#root'))

    class App extends React.Component{
        state = {
            num: 0
        }
        render() {
            console.log(this)
            return (
                <button onClick={function()  {
                    this.setState({
                        num: this.state.num+1
                    }) 
                }.bind(this)}>{this.state.num}</button>
            )
        }
    }

    root.render(<App/>)
</script>


</html>